package au.edu.unsw.infs3634.gamifiedlearning;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;

import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

import au.edu.unsw.infs3634.gamifiedlearning.adapter.JoinAdapter;
import au.edu.unsw.infs3634.gamifiedlearning.adapter.SendAdapter;
import au.edu.unsw.infs3634.gamifiedlearning.model.SendModel;

public class JoinList extends AppCompatActivity {


    private JoinAdapter adapter;
    private List<String> meetingList = new ArrayList<String>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_join_list);
        // Back button
        assert getSupportActionBar() != null;
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        setTitle("加入会议");
        init();
        RecyclerView listView = findViewById(R.id.joinList);
        adapter = new JoinAdapter(meetingList);
        listView.setAdapter(adapter);

        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        listView.setLayoutManager(linearLayoutManager);

        adapter.setOnItemListener((item) -> {
            Intent intent = new Intent(this, VideoMeetting.class);
//            intent.putExtra("meetingName",item);
            startActivity(intent);
        });

    }

    private void init() {
        for (int i = 0; i < 20; i++) {
            meetingList.add("会议名称--" + (i + 1));
        }
    }
    //Back button
    @Override
    public boolean onSupportNavigateUp() {
        finish();
        return true;
    }
}
